# Contributor: knuxify <knuxify@gmail.com>
# Maintainer: knuxify <knuxify@gmail.com>
pkgname=cutecom
pkgver=0.51.0
pkgrel=2
pkgdesc="Graphical serial terminal"
url="https://gitlab.com/cutecom/cutecom"
arch="all"
license="GPL-3.0-or-later"
makedepends="cmake qt5-qtbase-dev qt5-qtserialport-dev samurai"
subpackages="$pkgname-doc"
source="https://gitlab.com/cutecom/cutecom/-/archive/v$pkgver/cutecom-v$pkgver.tar.gz
	fix-qpainterpath.patch
	follow-system-colors.patch"
builddir="$srcdir/$pkgname-v$pkgver"
options="!check" # no test suite

build() {
	if [ "$CBUILD" != "$CHOST" ]; then
		CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	cmake -B build -G Ninja \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DBUILD_SHARED_LIBS=True \
		-DCMAKE_BUILD_TYPE=None \
		$CMAKE_CROSSOPTS .
	cmake --build build
}

package() {
	DESTDIR="$pkgdir" cmake --install build
	install -Dm644 "$builddir"/cutecom.desktop "$pkgdir"/usr/share/applications/cutecom.desktop
	install -Dm644 "$builddir"/images/cutecom.svg "$pkgdir"/usr/share/icons/hicolor/scalable/apps/cutecom.svg
	install -Dm644 "$builddir"/cutecom.1 "$pkgdir"/usr/share/man/man1/cutecom.1
}

sha512sums="
bb5235a6f420edfd3ff49beaf3d61722b1983c57270a54274e3c9ad35c28a5d91dd2cdea6db7de4be6c8a3034348ef08c4004edfcf246f7f4146b86930df50d5  cutecom-v0.51.0.tar.gz
5cbbb75beb4082be6e1d515b4d37a874d8a507a854e6844b6f0479af02db7575d54020c21e72fc5c2b6670de32b7edad18f7abe4ee69793782acca0ef09e4e05  fix-qpainterpath.patch
8663b67f9f875ea18aa0cc33e9ab855e2e9bc94a03e1287625e824015431e54ccb2a3482924c35aaf9b4ddec1e3ec8083dcd763ac220a3b9d6045a8bc6f65b0a  follow-system-colors.patch
"
